package graphicsExtended;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Stroke;

/**
 *
 * A class for resetting graphics
 * 
 * Fully Tested: No
 * Fully Documented: No
 * Created: 21-Apr-2012
 * Last Updated: 21-Apr-2012
 *
 * @author Shimu Wu
 */
public class ResettableGraphics {

    private Graphics2D graphics;

    private Color oldColor;

    private Stroke oldStroke;

    public ResettableGraphics(Graphics2D graphics) {
        this.oldColor = graphics.getColor();
        this.oldStroke = graphics.getStroke();
    }

    public void set(Color color, Stroke s) {
        graphics.setColor(color);
        graphics.setStroke(s);
    }

    public void reset() {
        graphics.setColor(oldColor);
        graphics.setStroke(oldStroke);
    }
}
